package com.pubinfo.passbook.data.controller.sync;

import com.pubinfo.passbook.common.model.vo.base.JsonResult;
import com.pubinfo.passbook.common.model.vo.base.ResultCode;
import com.pubinfo.passbook.common.service.contract.TContractSyncService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
@Api(tags = "合同同步-测试")
@RequestMapping(value = "contract")
public class ContractController {
  
  @Resource
  private TContractSyncService tContractSyncService;
  
  @GetMapping("sync")
  @ApiOperation(value = "同步合同")
  public JsonResult<ResultCode> sync() {
    tContractSyncService.syncContract(null);
//        tContractSyncService.syncContractCostItems();
//        tContractSyncService.syncContractProject();
    return new JsonResult<>();
  }
  
  @GetMapping("sync-wbs")
  @ApiOperation(value = "同步合同WBS项目")
  public JsonResult<ResultCode> syncWbs() {
//        tContractSyncService.syncContract();
    tContractSyncService.syncContractProject();
    return new JsonResult<>();
  }
  
  @GetMapping("sync-wbs1")
  @ApiOperation(value = "同步合同WBS项目成本")
  public JsonResult<ResultCode> syncWbs1() {
//        tContractSyncService.syncContract();
    tContractSyncService.syncContractCostItems();
    return new JsonResult<>();
  }
  
  @GetMapping("sync-not-clear")
  @ApiOperation(value = "同步未清项目")
  public JsonResult<ResultCode> syncNotClear() {
    tContractSyncService.syncProjectNotClear();
//        tContractSyncService.syncContractCostItems();
//        tContractSyncService.syncContractProject();
    return new JsonResult<>();
  }
  
}
